# RUN: llc -x mir -mtriple aarch64-apple-ios -run-pass mir-namer -mir-vreg-namer-use-stable-hash -verify-machineinstrs -o - < %s | FileCheck %s

---
name: foo
body:             |
  bb.0:

    ;CHECK-LABEL: bb.0
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:_(p0) = COPY $d0
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:_(<4 x s32>) = COPY $q0
    ;CHECK-NEXT: G_STORE %bb0_{{[0-9]+}}__1(<4 x s32>), %bb0_{{[0-9]+}}__1(p0) :: (store (<4 x s32>))

    liveins: $q0, $d0
    %1:fpr(p0) = COPY $d0
    %0:fpr(<4 x s32>) = COPY $q0
    G_STORE %0(<4 x s32>), %1(p0) :: (store (<4 x s32>))
...
---
name: bar
stack:
  - { id: 0, type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -4, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
body:             |
  bb.0:

    ;CHECK-LABEL: bb.0
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = LDRWui
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = MOVi32imm 1
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__2:gpr32 = LDRWui
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = MOVi32imm 2
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__3:gpr32 = LDRWui
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = MOVi32imm 3
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = nsw ADDWrr
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__4:gpr32 = LDRWui
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__2:gpr32 = nsw ADDWrr
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = MOVi32imm 4
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__3:gpr32 = nsw ADDWrr
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__5:gpr32 = LDRWui
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = MOVi32imm 5

    %0:gpr32 = LDRWui %stack.0, 0 :: (dereferenceable load (s64))
    %1:gpr32 = MOVi32imm 1
    %2:gpr32 = LDRWui %stack.0, 0 :: (dereferenceable load (s64))
    %3:gpr32 = MOVi32imm 2
    %4:gpr32 = LDRWui %stack.0, 0 :: (dereferenceable load (s64))
    %5:gpr32 = MOVi32imm 3
    %10:gpr32 = nsw ADDWrr %0:gpr32, %1:gpr32
    %6:gpr32 = LDRWui %stack.0, 0 :: (dereferenceable load (s64))
    %11:gpr32 = nsw ADDWrr %2:gpr32, %3:gpr32
    %7:gpr32 = MOVi32imm 4
    %12:gpr32 = nsw ADDWrr %4:gpr32, %5:gpr32
    %8:gpr32 = LDRWui %stack.0, 0 :: (dereferenceable load (s64))
    %9:gpr32 = MOVi32imm 5
    %13:gpr32 = nsw ADDWrr %6:gpr32, %7:gpr32
    %14:gpr32 = nsw ADDWrr %8:gpr32, %9:gpr32
    %15:gpr32 = nsw ADDWrr %10:gpr32, %11:gpr32
    %16:gpr32 = nsw ADDWrr %12:gpr32, %13:gpr32
    %17:gpr32 = nsw ADDWrr %14:gpr32, %15:gpr32
    %18:gpr32 = nsw ADDWrr %16:gpr32, %17:gpr32
    $w0 = COPY %18
    RET_ReallyLR implicit $w0
...
---
name: baz
stack:
  - { id: 0, type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -4, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
body:             |
  bb.0:
    liveins: $x0, $x1, $d0, $d1

    ;CHECK-LABEL: bb.0:
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = LDRWui %stack.0, 0
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = COPY %bb0_{{[0-9]+}}__1
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__1:gpr32 = COPY %bb0_{{[0-9]+}}__1
    ;CHECK-NEXT: %bb0_{{[0-9]+}}__2:gpr32 = COPY %bb0_{{[0-9]+}}__1
    ;CHECK-NEXT: $w0 = COPY %bb0_{{[0-9]+}}__2

    %0:gpr32 = LDRWui %stack.0, 0 :: (dereferenceable load (s64))
    %1:gpr32 = COPY %0
    %2:gpr32 = COPY %1
    %3:gpr32 = COPY %2
    $w0 = COPY %3
    RET_ReallyLR implicit $w0
...

